How They Really Work
Osher Lifelong Learning
Institute
University of Illinois, Urbana-Champaign
Scott Badman, Instructor
Binary Arithmetic
The binary number system (base 2), works by exactly the same rules as our usual decimal number system (base 10). They are the same rules we learned in elementary school
How many buttons were on E.T.'s phones, back on his home planet?
Counting in binary - driving a brand new binary car for the first 15 miles.
The patterns of the 0's and 1's in columns, and the column values (in decimal, in exponents, and in binary).
Converting from binary to decimal by adding the column value if there is a 1, doing nothing if there is a 0.
Directly adding two binary numbers together, using the binary addition table.
Use calculator as check.
Negative numbers
Not the same system we learned in Elementary School, which adds another symbol, the negative sign, to the ten digits of positive numbers.
Count backwards from ...1111111
In Decimal, this would be counting backwards from ...999999
Negating a number:
Invert the bits (subtract from 9 in decimal)
Add 1
Huge benefit: subtraction simply becomes addition.
Multiplying two binary numbers by the rules we learned in 3rd grade, using the binary multiplication table.
Neat trick: doing the same multiplication by shift and add.
Hexadecimal numbers (base 16) are mainly used as a shorthand for binary numbers. Each hex digit represents 4 binary digits.
Example: IPv6 addresses